package com.cn.kehong.controller;


import com.cn.kehong.api.ICurveWeightService;
import com.cn.kehong.domain.CurveWeight;
import com.cn.kehong.utils.JsonResponse;
import com.cn.kehong.utils.QueryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/curveWeight")
public class CurveWeightController {

    @Autowired
    private ICurveWeightService curveWeightService;

    @RequestMapping("/getCurveWeights/{frontToken}")
    @ResponseBody
    public JsonResponse<List<CurveWeight>> getCurveWeights(QueryForm queryForm, @PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<List<CurveWeight> > response = new JsonResponse<List<CurveWeight> >();
        List<CurveWeight> lists = curveWeightService.getCurveWeights(queryForm);
        response.setResult(lists);
        response.setSuccess(true);
        return  response;
    }
}
